
<!--_meta 作为公共模版分离出去-->
{include file="public/_meta"}

<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-api-edit">
		<input type="hidden" class="input-text" value="{$task['id']}" placeholder="" id="" name="id">
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>任务名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$task['task_name']}" placeholder="" id="" name="task_name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>任务地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$task['task_url']}" placeholder="如：task/index/index" id="" name="task_url">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>请求时间：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$task['task_start_time']}" placeholder="如：2017-10-15 15:00:00" id="" name="task_start_time">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>排序：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$task['sort']}" placeholder="" id="" name="sort">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>任务描述：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="task_description" cols="" rows="" class="textarea"  placeholder="任务描述...最少输入10个字符" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)">{$task['task_description']}</textarea>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-9 col-sm-10 col-xs-offset-3 col-sm-offset-2">
				<button type="submit" class="btn btn-success radius" id="api-add"><i class="icon-ok"></i> 修改</button>
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer"}


<script type="text/javascript">
    function textarealength(obj,sum) {

    }
	$("#form-api-edit").validate({
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			var data = $(form).serializeArray();
			$(form).ajaxSubmit({
				type: 'post',
				url: "{:url('task/edit_task')}",
				dataType: 'json',
				data: data,
				success: function(msg){
				    if(msg.status == true){
                        layer.msg(msg.message,{icon: 6,time:1000});
                        setTimeout(jump,1000);
                        function jump(){
                            parent.location.reload();
                        }
					}else if(msg.status == false){
                        layer.msg(msg.message,{icon: 5,time:2000});
					}
				}
			});
		}
	});

</script>
